
class CycleList {
    head;
    end;
    index;
    constructor(val) {
        this.index=1;
        this.head.val=val;
        this.head.index=this.index;
        this.head.next=node;
        this.end=head;
        return head;
    };
    node(val,next){
        let node;
        node.val=val;
        node.index=this.index;
        node.next=next;
        return node;
    }
    endadd(val){
        this.index++;
        let node=this.node(val,this.head);
        this.end.next=node;
        this.end=node;
        return head;
    }
    superadd(index,val){
        this.index++;
        let i=1;
        let node=this.head;
        while(i<this.index||node.next==this.head){
            node=node.next;
            i++;
        }
        let mews=this.node(val,node.next);
        node.next=news;
    }
    delete(index){
        this.index--;
        let i=1;
        let node=this.head;
        while(i<this.index||node.next==this.head){
            node=node.next;
            i++;
        }
        node.next=node.next.next;
        return head;
    }
    change(index,news){
        let i=1;
        let node=this.head;
        while(i<this.index||node.next==this.head){
            node=node.next;
            i++;
        }
        node.val=news;
        return head;
    }
    search(val){
        let node=this.head;
        while(node.next==this.head){
            node=node.next;
        }
        return node.index;
    }
    show(){
        let node=this.head;
        let list;
        while(node.next==this.head){
            list[node.index-1]=node.val;
            node=node.next;
        }
        return list;
    }
}